<?php

namespace app\shop\model\company;

use think\Model;
use app\shop\model\user\User;
use think\model\concern\SoftDelete;
/**
 * 应用模型
 */
class StaffLeave extends Model
{
    use SoftDelete;
    protected $autoWriteTimestamp = true;

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id', 'user_id');
    }
    //离职时间
    public function getLeaveTimeAttr($value)
    {
        return $value ? date('Y-m-d', $value) : "";
    }

    public function setLeaveTimeAttr($value)
    {
        return $value ? strtotime(date("Y-m-d", strtotime($value))) : null;
    }
}
